package com.hongji.lms5xxcommunicator.entity;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class GridSnapshotDto {

    private Spec   spec;     // {x0,y0,rows,cols,dx,dy,unit?,x1?,y1?}
    private Cells  cells;    // 稀疏网格：r[], c[], z[]
    private Volume volume;   // {value, unit?}

    // —— 分页元数据（可选） ——
    private String  nextCursor;
    private Boolean hasMore;
    private Integer count;
    private Long    total;

    // —— 新增：前端着色范围与版本号 ——
    private Double zMin;
    private Double zMax;
    private Long   rangeSeq;

    @Data @Builder @NoArgsConstructor @AllArgsConstructor
    public static class Spec {
        public double  x0;
        public double  y0;
        public Integer rows;
        public Integer cols;
        public double  dx;
        public double  dy;
        public String  unit;   // "mm"
        public Double  x1;     // 可选
        public Double  y1;     // 可选
    }

    @Data @Builder @NoArgsConstructor @AllArgsConstructor
    public static class Cells {
        public int[]    r;
        public int[]    c;
        public double[] z;
        public int[]    n;     // 可选：累计点数
    }

    @Data @Builder @NoArgsConstructor @AllArgsConstructor
    public static class Volume {
        public double value;   // m³
        public String unit;    // "m3"
    }
}
